// @flow
import configure, { sagaMiddleware } from './configure';
import modules from './modules'; // 引用具体reducer模块
import type { Auth } from './modules/auth';
// import type { User } from './modules/user';
import type { Base } from './modules/base';
// import type { Write } from './modules/write';
import type { Things } from './modules/things';
import { RootSaga as sampleSaga, type Sample } from './modules/sample';

const store = configure();
// then run the saga
modules.sagas.map(item => {
    sagaMiddleware.run(item);
});

export default store;

export type State = {
    auth: Auth,
    // user: User,
    base: Base,
    // write: Write,
    // posts: Posts,
    sample: Sample,
    things: Things
};
